﻿<script src="~/Scripts/AdminControllers/ChurchWorkerController.js"></script>
<div class="row" ng-controller="ChurchWorkerController">
    <div class="search-bar collapsed">
        <div class="form-group">
            <div class="input-group input-group-lg">
                <input type="text" class="form-control" placeholder="Type to search..." ng-model="searchkey" ng-change="Search()">
                <span class="input-group-btn">
                    <button class="btn btn-square btn-lg btn-default no-shadow close-search-bar" type="button" ng-click="searchkey='';Search();"><i class="zmdi zmdi-close"></i></button>
                </span>
            </div>
        </div>
    </div>
    <div class="col-md-12">
        <div class="bg-white bs-0 mb-20 widget">
            <div class="custom-grid-header">
                <div class="custom-grid-name">
                    ChurchWorkers
                </div>
                <div class="custom-grid-menu">
                    <ul class="custom-grid-menu-ul pull-right">
                        <li class="custom-grid-menu-ul-li" ng-click="ChangeView()">
                            <a href="javascript:;" class="text-white"><i class="zmdi zmdi-card-membership"></i></a>
                        </li>
                        <li class="custom-grid-menu-ul-li dropdown">
                            <a href="javascript:;" class="dropdown-toggle text-white"><i class="zmdi zmdi-print"></i></a>
                            <ul class="dropdown-menu dropdown-menu-right animated flipInY" style="margin-top: 4px; padding: 0px; width: 220PX;">
                                <li class="sortmenu">
                                    <div class="sort-col-1"><i class="zmdi zmdi-print"></i></div>
                                    <div class="sort-col-2"><a target="_blank" href="Members/PrintFamilyReports">Print All Family</a></div>
                                    <div class="clearfix"></div>
                                </li>
                                <li class="sortmenu">
                                    <div class="sort-col-1"><i class="zmdi zmdi-print"></i></div>
                                    <div class="sort-col-2"><a target="_blank" href="Members/PrintFamilyWithMembersReports">Print Family and Members</a></div>
                                    <div class="clearfix"></div>
                                </li>
                            </ul>
                        </li>
                        <li class="custom-grid-menu-ul-li" ng-click="toggle('add','')">
                            <a href="javascript:;" class="text-white"><i class="fa fa-plus-circle"></i></a>
                        </li>
                        <li class="custom-grid-menu-ul-li dropdown">
                            <a href="javascript:;" class="dropdown-toggle text-white"><i class="zmdi zmdi-sort"></i></a>
                            <ul class="dropdown-menu dropdown-menu-right animated flipInY" style="margin-top: 4px; padding: 0px; width: 220PX;">
                                <li class="sortmenu" ng-click="sortby='DEFAULT';sort()" ng-class="{sortactive:sortby=='DEFAULT'}">
                                    <div class="sort-col-1"><i class="zmdi zmdi-sort-by-alpha"></i></div>
                                    <div class="sort-col-2">Default</div>
                                    <div class="clearfix"></div>
                                </li>
                                <li class="sortmenu" ng-click="sortby='NAME';sort()" ng-class="{sortactive:sortby=='NAME'}">
                                    <div class="sort-col-1"><i class="zmdi zmdi-sort-by-alpha"></i></div>
                                    <div class="sort-col-2">Name</div>
                                    <div class="clearfix"></div>
                                </li>
                                <li class="sortmenu" ng-click="sortby='EMAIL';sort()" ng-class="{sortactive:sortby=='EMAIL'}">
                                    <div class="sort-col-1"><i class="zmdi zmdi-sort-by-alpha"></i></div>
                                    <div class="sort-col-2">Email</div>
                                    <div class="clearfix"></div>
                                </li>
                                <li class="sortmenu" ng-click="sortby='PHONE';sort()" ng-class="{sortactive:sortby=='PHONE'}">
                                    <div class="sort-col-1"><i class="zmdi zmdi-sort-by-alpha"></i></div>
                                    <div class="sort-col-2">Phone</div>
                                    <div class="clearfix"></div>
                                </li>
                                <li class="sortmenu" ng-click="sortby='REFNO';sort()" ng-class="{sortactive:sortby=='REFNO'}">
                                    <div class="sort-col-1"><i class="zmdi zmdi-sort-by-alpha"></i></div>
                                    <div class="sort-col-2">Refference Number</div>
                                    <div class="clearfix"></div>
                                </li>
                            </ul>
                        </li>
                    </ul>
                    <div class="clearfix"></div>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="widget-body">
                <div class="row">
                    <div class="col-md-12" ng-show="viewmode=='TABLE'">
                        <table class="table table-striped table-bordered">
                            <thead>
                                <th style="width: 10%">REF NO</th>
                                <th style="width: 20%">FULL NAME</th>
                                <th style="width: 15%">EMAIL</th>
                                <th style="width: 15%">PHONE</th>
                                <th style="width: 20%">DESIGNATION</th>
                                <th style="width: 20%">ACTION&nbsp;</th>
                            </thead>
                            <tbody>
                                <tr ng-repeat="data in list">
                                    <td>{{data.ChruchWokerRefNo}}</td>
                                    <td>{{data.Designation.ChurchWorkerDesignationAbrivation}}. {{data.Initial}} {{data.FirstName}} {{data.MiddleName}} {{data.LastName}} </td>
                                    <td>{{data.Email}}</td>
                                    <td>{{data.Phone}}</td>
                                    <td>{{data.Designation.ChurchWorkerDesignationName}}</td>
                                    <td>
                                        <div class="btn-group-sm" role="group" aria-label="Second group">
                                            <button type="button" class="btn btn-info waves-effect" ng-click="toggle('edit',data.ChurchWorkerId);"><i class="fa fa-pencil"></i></button>
                                            <button type="button" class="btn btn-danger waves-effect" ng-click="delete(data.FullName,data.ChurchWorkerId)"><i class="fa fa-trash"></i></button>
                                            <a class="btn btn-success waves-effect" href="ChurchWorkers/ChurchWorkerInfo?ChurchWorkerId={{data.ChurchWorkerId}}"><i class="fa fa-info-circle"></i></a>
                                            <a class="btn btn-purple waves-effect" target="_blank" href="ChurchWorkers/PrintChurchWorkerDetails?ChurchWorkerId={{data.ChurchWorkerId}}"><i class="zmdi zmdi-print"></i></a>
                                            @*<a class="btn btn-primary waves-effect" target="_blank" href="ChurchWorkers/ChurchWorkerInfo?ChurchWorkerId={{data.ChurchWorkerId}}"><i class="fa fa-print"></i></a>
                                            <a class="btn btn-warning waves-effect" title="Documents" ng-click="ChurchWorker(data.ChurchWorkerId)"><i class="fa fa-file-archive-o"></i></a>
                                            <a class="btn btn-gray waves-effect" title="Language" ng-click="ChurchWorker(data.ChurchWorkerId)"><i class="zmdi zmdi-speaker"></i></a>
                                            <a class="btn btn-lime waves-effect" title="Designation" ng-click="ChurchWorker(data.ChurchWorkerId)"><i class="zmdi zmdi-input-antenna"></i></a>
                                            <a class="btn btn-orange waves-effect" title="Family Details" ng-click="ChurchWorker(data.ChurchWorkerId)"><i class="zmdi zmdi-local-florist"></i></a>
                                            <a class="btn btn-purple waves-effect" title="Left Organization" ng-click="ChurchWorker(data.ChurchWorkerId)"><i class="zmdi zmdi-arrow-forward"></i></a>
                                            <a class="btn btn-info waves-effect" title="Activate/Deactivate" ng-click="ChurchWorker(data.ChurchWorkerId)"><i class="zmdi zmdi-arrow-split"></i></a>
                                            <a class="btn btn-info waves-effect" title="Create Login" ng-click="ChurchWorker(data.ChurchWorkerId)"><i class="zmdi zmdi-arrow-split"></i></a>*@
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="col-md-12" ng-show="viewmode=='CARD'">
                        <ul class="card">
                            <li ng-repeat="data in list">
                                <div class="card-container">
                                    <div class="card-container-row">
                                        <div class="card-image">
                                            <img class="media-object mo-lg img-circle mCS_img_loaded" src="/Uploads/uploaded/_productlogo.png" alt="">
                                        </div>
                                        <div class="card-details">
                                            <div class="card-details-row-1"><i class="fa fa-user"></i>{{data.FullName}}</div>
                                            <div class="card-details-row-2"><i class="fa fa-phone"></i>{{data.Phone}}</div>
                                            <div class="card-details-row-3"><i class="zmdi zmdi-email"></i>{{data.Email}}</div>
                                        </div>
                                        <div class="clearfix"></div>
                                    </div>
                                    <div class="card-action">
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </div>
                    <div gridloader></div>
                    <div nodata></div>
                </div>
                <div ng-show="list.length > 0" style="padding-right: 10px; text-align: right;">
                    <div pagination="" page="currentPage" max-size="10" on-select-page="setPage(page)" boundary-links="true" total-items="filteredItems" items-per-page="entryLimit" class="pagination-small" previous-text="«" next-text="»"></div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade bs-example-modal-panel" tabindex="-1" id="ChurchWorker" role="dialog" aria-labelledby="myPanelModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header bg-primary">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">{{title}}</h4>
                </div>
                <form name="fromvalidate" novalidate>
                    <div class="modal-body">
                        <div class="form-group">
                            <div class="col-md-6" style="padding: 0px;">
                                <div class="form-group">
                                    Designation
                                    <select ng-model="ChurchWorker.ChurchWorkerDesignationId"
                                        ng-options="obj.ChurchWorkerDesignationId as obj.ChurchWorkerDesignationName for obj in ChurchWorkerDesignation"
                                        class="form-control" ng-required="true">
                                    </select>
                                </div>
                            </div>
                            <div class="col-md-6" style="padding-left: 10px; padding-right: 0px;">
                                <div class="form-group">
                                    Initial
                                    <input type="text" class="form-control" ng-model="ChurchWorker.Initial" maxlength="1" ng-required="false">
                                </div>
                            </div>
                            <div class="clearfix"></div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-4" style="padding: 0px;">
                                <div class="form-group">
                                    First Name
                                    <input type="text" class="form-control" ng-model="ChurchWorker.FirstName" ng-required="true">
                                </div>
                            </div>
                            <div class="col-md-4">
                                <div class="form-group">
                                    Middle Name
                                    <input type="text" class="form-control" ng-model="ChurchWorker.MiddleName" ng-required="false">
                                </div>
                            </div>
                            <div class="col-md-4" style="padding: 0px;">
                                <div class="form-group">
                                    Last Name
                                    <input type="text" class="form-control" ng-model="ChurchWorker.LastName" ng-required="false">
                                </div>
                            </div>
                            <div class="clearfix"></div>
                        </div>

                        <div class="form-group">
                            Gender
                            <select ng-model="ChurchWorker.Gender"
                                ng-options="obj.Gender as obj.GenderName for obj in Genders"
                                class="form-control" ng-required="true">
                            </select>
                        </div>
                        <div class="form-group">
                            Native Place
                            <input type="text" class="form-control" ng-model="ChurchWorker.NativePlace" ng-required="false">
                        </div>
                        <div class="form-group">
                            Father's Name
                            <input type="text" class="form-control" ng-model="ChurchWorker.Fathers" ng-required="false">
                        </div>
                        <div class="form-group">
                            Date Of Birth
                            <input type="text" class="form-control" ng-model="ChurchWorker.DateOfBirth" calendar ng-required="false">
                        </div>
                        <div class="form-group">
                            Date Of Salvation
                            <input type="text" class="form-control" ng-model="ChurchWorker.DateOfSalvation" calendar ng-required="false">
                        </div>
                        <div class="form-group">
                            Date Of Baptism
                            <input type="text" class="form-control" calendar ng-model="ChurchWorker.DateOfBaptism">
                        </div>
                        <div class="form-group">
                            Date Of Anointing
                            <input type="text" class="form-control" calendar ng-model="ChurchWorker.DateOfAnointing">
                        </div>
                        <div class="form-group">
                            Date Of Joining In full time Minitry
                            <input type="text" class="form-control" calendar ng-model="ChurchWorker.DateOfJoiningInMinitry">
                        </div>
                        <div class="form-group">
                            Date Of Joining In our Minitry
                            <input type="text" class="form-control" calendar ng-model="ChurchWorker.DateOfJoiningInOurMinitry">
                        </div>
                        <div class="form-group">
                            <input type="checkbox" ng-model="ChurchWorker.IsTakenTraining">
                            Is Taken Training
                        </div>
                        <div class="form-group" ng-show="ChurchWorker.IsTakenTraining">
                            Year Training
                            <input type="text" class="form-control" ng-model="ChurchWorker.YearOfTraining" ng-required="ChurchWorker.IsTakenTraining">
                        </div>
                        <div class="form-group" ng-show="ChurchWorker.IsTakenTraining">
                            Place Of Training
                            <input type="text" class="form-control" ng-model="ChurchWorker.PlaceOfTraining" ng-required="ChurchWorker.IsTakenTraining">
                        </div>
                        <div class="form-group">
                            Education
                            <input type="text" class="form-control" ng-model="ChurchWorker.Education">
                        </div>
                        
                        <div class="form-group">
                            <input type="checkbox" ng-model="ChurchWorker.IsMarried">
                            Is Married
                        </div>
                        <div class="form-group" ng-show="ChurchWorker.IsMarried">
                            Date Of Marriage
                            <input type="text" class="form-control" calendar ng-model="ChurchWorker.DateOfMarriage">
                        </div>
                        <div class="form-group" ng-show="ChurchWorker.IsMarried">
                            Name Of Wife/Husband
                            <input type="text" class="form-control" ng-model="ChurchWorker.NameOfLifePartner">
                        </div>
                        <div class="form-group">
                            Country
                            <select ng-model="ChurchWorker.PresentAddress.PresentCountryId"
                                ng-options="obj.CountryId as obj.CountryName for obj in countries"
                                class="form-control" ng-required="true">
                            </select>
                        </div>
                        <div class="form-group">
                            State
                            <select ng-model="ChurchWorker.PresentAddress.PresentState"
                                ng-options="obj.StateId as obj.StateName for obj in states"
                                class="form-control"
                                ng-required="true">
                            </select>
                        </div>
                        <div class="form-group">
                            City
                            <input type="text" class="form-control" name="PresentCity" ng-model="ChurchWorker.PresentAddress.PresentCity">
                        </div>
                        <div class="form-group">
                            Address
                            <textarea class="form-control" name="PresentAdress" ng-model="ChurchWorker.PresentAddress.PresentAddress" maxlength="100" ng-required="true"></textarea>
                        </div>
                        <div class="form-group">
                            Pincode
                            <input type="text" class="form-control" name="PresentPin" ng-model="ChurchWorker.PresentAddress.PresentPin" ng-maxlength="6" ng-minlength="6">
                            <p class="error" ng-show="fromvalidate.PresentPin.$error.minlength">Invalid pin</p>
                            <p class="error" ng-show="fromvalidate.PresentPin.$error.maxlength">Invalid pin</p>
                        </div>
                        <div class="form-group">
                            Photo
                            <input type="file" name="fileInput" onchange="angular.element(this).scope().fileChangedChurchWorkerImage(event)" class="upload" accept="image/*">
                        </div>
                        <div class="form-group">
                            Application Copy
                            <input type="file" name="fileInput" onchange="angular.element(this).scope().fileChangedChurchWorkerApplication(event)" class="upload" accept="image/*">
                        </div>
                        <div class="form-group" ng-show="ChurchWorker.IsMarried">
                            Date Of Application
                            <input type="text" class="form-control" calendar ng-model="ChurchWorker.DateOfApplication">
                        </div>
                        <div class="form-group" ng-show="ChurchWorker.IsMarried">
                            Place Of Application
                            <input type="text" class="form-control" ng-model="ChurchWorker.PlaceOfApplication">
                        </div>
                        <div class="form-group">
                            Email
                            <input type="text" class="form-control" name="MotherName" ng-model="ChurchWorker.Email">
                        </div>
                        <div class="form-group">
                            Phone
                            <input type="text" class="form-control" name="MotherName" ng-model="ChurchWorker.Phone">
                        </div>
                         <div class="form-group">
                            Current Status
                            <select ng-model="ChurchWorker.ChurchWorkerStatusId"
                                ng-options="obj.ChurchWorkerStatusId as obj.ChurchWorkerStatusName for obj in ChurchWorkerStatuss"
                                class="form-control"
                                ng-required="true">
                            </select>
                        </div>
                        <div class="form-group">
                            Remarks
                            <textarea class="form-control" ng-model="ChurchWorker.Remarks"></textarea>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                        <button type="button" class="btn btn-primary" ng-disabled="fromvalidate.$invalid || buttonstate" ng-click="save(modelstate);">Save</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

@for (var i = 0; i <= ViewBag.Page.PageSection.Count - 1; i++)
{
    @Html.Raw(ViewBag.Page.PageSection[i].TemplateContent)
}

